import { serverUrl, getRequest, postRequestForm } from '@/utils/request';

/**
 * @param {string} 获取订单信息
 */
export const getPayOrder = (deviceId) => {
  return request({
    url: '/app/security/aliMini/miniPay/fee',
    method: 'GET',
    data: { deviceId }
  });
};

/**
 * @param {string} 获取订单信息
 */
export const getPayOrderFree = (deviceId) => {
  return request({
    url: '/app/security/aliMiniPay/mini/fee',
    method: 'GET',
    data: { deviceId }
  });
};

/**
 * @param {string} 获取查询订单
 */
export const checkPayIsValid = (orderUuid) => {
  return request({
    url: '/app/security/pay/check',
    method: 'GET',
    data: { orderUuid }
  });
};

export const unfreezePayOrder = (orderId) => {
  return request({
    url: '/app/sharingweb/app/security/aliMiniPay/mini/unFreeZe',
    method: 'GET',
    data: { orderId }
  });
};

export const payBePaidOrderFree = (orderId) => {
  return request({
    url: '/app/rentbox/order/pay/aliMini',
    method: 'GET',
    data: { orderId }
  });
};

export const login = (code) => {
  return request({
    url: '/shiro/aliMini/login',
    method: 'GET',
    data: { code }
  });
};

export const getUserInfo = () => {
  return request({
    url: '/app/aliMini/userCenter',
    method: 'POST'
  });
};

export const saveUserInfo = (phone) => {
  return request({
    url: '/app/aliMini/phoneDecrypt',
    method: 'POST',
    data: phone
  });
};

export const getCouponsList = () => {
  return request({
    url: '/app/wechatMini/ucenter/coupon/list',
    method: 'GET'
  });
};

export const isFinishDeposit = () => {
  return request({
    url: '/app/aliMini/hasSecurityOrder',
    method: 'GET'
  });
};

export const getWhitelistDetail = (obj) => {
  return request({
    url: '/app/wechatMini/whitelist',
    method: 'GET',
    data: {
      whitelistId: obj.whitelistId,
      uuid: obj.uuid
    }
  });
};

export const addWhitelist = (obj) => {
  return request({
    url: '/app/whiteist/record/users/obtain',
    method: 'GET',
    data: {
      whitelistId: obj.whitelistId,
      uuid: obj.uuid,
      businessId: obj.businessId
    }
  });
};
